Skip to content

fix: 8.1.16 bug-fix batch (BUG-1 to BUG-8)#17

Merged
cct08311github merged 8 commits intodotnet8from
feature/8.1.16-bugfix
Mar 4, 2026
Merged

fix: 8.1.16 bug-fix batch (BUG-1 to BUG-8)#17
cct08311github merged 8 commits intodotnet8from
feature/8.1.16-bugfix

Conversation

@cct08311github
Copy link
Copy Markdown
Owner

Summary

8-bug stabilization batch for 8.1.16, all P0/P1 issues from the spec.

  • BUG-1 fix(codegen): Prevent NullRef in GenerateAddFKModel; skip readonly fields in test gen
  • BUG-2 fix(upload): Handle non-image files in UploadImage — return 400 instead of 500
  • BUG-3 fix(tenant): File access bypasses tenant query filter via IgnoreQueryFilters()
  • BUG-4 fix(workflow): Elsa workflow tables not auto-created in MySQL (null schema fix)
  • BUG-5 fix(codegen): CodeGen path fails in non-standard environments (\bin\Debug\ not found)
  • BUG-6 fix(ui): ComboBox respects item.Selected when no DefaultValue is set
  • BUG-7 feat(multidb): Add Enabled toggle per database connection in appsettings.json
  • BUG-8 perf(oracle): Add DbConnectionWarmupService to pre-warm connection pools at startup

Closes #14, #15, #16

Test plan

  • Build passes on CI
  • CodeGen: open a model with a FK navigation property — no NullRef thrown
  • CodeGen: generated test code compiles (no assignment to read-only properties)
  • Upload: POST a non-image file to /File/UploadImage → 400 returned
  • Multi-tenant: system admin uploads file; tenant user can download it by UUID
  • Workflow: MySQL deployment auto-creates Elsa schema tables on first run
  • Oracle: set Enabled: false on a connection → app starts without waiting for that DB
  • Oracle: connection pool pre-warm log appears within 5s of startup

🤖 Generated with Claude Code

cct0831 and others added 8 commits March 4, 2026 15:01
…elds in test gen [BUG-1]

- Add null guard at entry of GenerateAddFKModel (t == null → return "")
- Add null check before dereferencing fktype.Name in GenerateTest and GenerateAddFKModel
- Add fktype != null guards in recursive FK resolution to avoid null propagation
- Add pro.SetMethod != null check in GetRandomValues to skip get-only properties,
  preventing generated test code from assigning values to readonly fields

Upstream: dotnetcore/WTM#490, dotnetcore/WTM#654

Part of #14

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Wrap Image.Load() in try-catch: ImageSharp throws UnknownImageFormatException
  when a non-image file is uploaded (never returns null as the old null check assumed)
- Return 400 Bad Request instead of propagating unhandled exception (500)

Upstream: dotnetcore/WTM#652

Part of #14

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Filters [BUG-3]

- FileAttachment implements ITenant, so EF applies TenantCode query filter to all lookups
- Files uploaded by system admin (TenantCode=null) were invisible to tenant users because
  the filter WHERE TenantCode = 'tenant_a' excluded NULL-tenant files
- Fix: use IgnoreQueryFilters() in GetFile, DeleteFile, GetFileName so files are retrieved
  by ID regardless of tenant — file IDs (UUIDs) already serve as capability tokens

Upstream: dotnetcore/WTM#650

Part of #14

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add Enabled property to CS config model (default: true for backward compatibility)
- Filter disabled connections in AddWtm startup loop (skip EnsureCreate)
- Wrap EnsureCreate() in try-catch so one bad connection doesn't block others
- Update GetCS() routing to exclude disabled connections and their read replicas
- Guard CreateDC() in WTMContext: throws clear InvalidOperationException when
  code attempts to use a disabled connection at runtime

Allows graceful degradation when Oracle or other secondary DB is unreachable.
Set Enabled: false in appsettings.json Connections array to disable a connection.

Part of #16

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ols [BUG-8]

- BackgroundService runs 2s after startup, calls CanConnectAsync() on each
  enabled connection to pre-warm the connection pool
- Moves Oracle's ~60s cold start (TNS resolution, pool creation, ODP.NET
  metadata loading) from first user request to app boot (background)
- Fault-tolerant: logs warning on failure, never crashes app or blocks startup
- Respects BUG-7 Enabled toggle: skips disabled connections

Root cause: ODP.NET cold start includes TNS resolution, connection pool creation,
internal metadata loading, and self-tuning calibration — all on first Open().
Pre-warming with CanConnectAsync() during boot triggers all of this up front.

Part of #16

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- MySQL treats schema = database; applying the default Elsa schema name "Elsa"
  causes EF Core to look for a separate MySQL database that may not exist
- Fix: return null schema for MySQL (via ProviderName check), same as Oracle
- This allows Elsa to create its tables in the current MySQL database without
  a schema prefix

Upstream: dotnetcore/WTM#659

Part of #15

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ironments [BUG-5]

- MainDir computation: fix crash when AppDomain.BaseDirectory lacks \bin\Debug\ or
  \bin\Release\ (e.g. dotnet run from repo root, Docker containers, published apps).
  Previous code set index=-1 and called Substring(0,-1) → ArgumentOutOfRangeException.
  Fix: fall back to Directory.GetCurrentDirectory() when bin path not found.
- GetAllModels(): guard against null DcConstructor (e.g. connections with Enabled=false
  from BUG-7 fix, or when no matching DataContext constructor is found via reflection).

Upstream: dotnetcore/WTM#661

Part of #15

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…G-6]

When the user provides a custom Items list with pre-set Selected=true flags
and no field model value or DefaultValue is resolved (selectVal is empty),
the previous code forced all items to Selected=false, ignoring the user's intent.

Fix: only override item selection state when selectVal has entries.
If selectVal is empty, the existing Selected values on items are preserved.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@cct08311github cct08311github merged commit 65c60db into dotnet8 Mar 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Code generator, file upload, multi-tenant stability fixes (P0)

1 participant